# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models

# Create your models here.
from django.utils.encoding import python_2_unicode_compatible
from pep.models import Worker_info

'''项目类型：研发、实施、虚拟'''
@python_2_unicode_compatible
class Type_info(models.Model):
    type_name = models.CharField(max_length=32, verbose_name='项目类型')

    def __str__(self):
        return self.type_name

    class Meta:
        db_table = 'prj_type_info'
        verbose_name = '项目类型'
        verbose_name_plural = '项目类型'

'''项目阶段：立项、开发、测试、上线、维护、结项'''
@python_2_unicode_compatible
class Status_info(models.Model):
    status_name = models.CharField(max_length=32, verbose_name='项目阶段')

    def __str__(self):
        return self.status_name

    class Meta:
        db_table = 'prj_status_info'
        verbose_name = '项目阶段'
        verbose_name_plural = '项目阶段'

'''项目详情'''
@python_2_unicode_compatible
class Detail_info(models.Model):
    type_number = models.ForeignKey(Type_info, verbose_name='项目类型')
    detail_number = models.CharField(max_length=32, verbose_name='项目编号')
    detail_name = models.CharField(max_length=128, verbose_name='项目名称')
    pm_name = models.ForeignKey(Worker_info, verbose_name='项目经理')
    prd_name = models.CharField(max_length=128, verbose_name='实施产品')
    status_name = models.ForeignKey(Status_info, verbose_name='项目状态')
    start_date = models.DateField(verbose_name='立项日期')
    running_date = models.DateField(verbose_name='上线日期')
    end_date = models.DateField(verbose_name='结项日期')

    def __str__(self):
        return self.detail_name

    class Meta:
        db_table = 'prj_detail_info'
        verbose_name = '项目信息'
        verbose_name_plural = '项目信息'